<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<script type="text/javascript">
    window.onbeforeunload = onbeforeunload_handler;
    window.onunload = onunload_handler;
    function onbeforeunload_handler(){
        //window.location.href="/index.php/auth/logout";
        confirm("33");
         return true;
    }

    function onunload_handler(){
        console.log(22222);
        var warning="333谢谢光临";
        alert(warning);
    }
</script>
<a href="http://dt.l">dt</a>
</body>
</html>